/*
 * Copyright 2011 Fabian Wenzelmann
 * 
 * This file is part of Recognition-Procedures-for-Boolean-Functions.
 * 
 * Recognition-Procedures-for-Boolean-Functions is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * Recognition-Procedures-for-Boolean-Functions is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with Recognition-Procedures-for-Boolean-Functions.  If not, see <http://www.gnu.org/licenses/>.
 */

package de.wenzelmf.booleanFunction.lpb.combinatorial.occurrencePattern;

/**
 * A class that represents an entry that can be used by occurrence patterns to store the information.
 * 
 * A object of this class consists of a number (the clause size) and the number of occurrences of
 * this clause size.
 * 
 * @author Fabian Wenzelmann
 * @version 1.0
 *
 */
public class OccurrencePatternEntry
{
	/*
	 * The clause size.
	 */
	private final int number;
	
	/* 
	 * The number of occurrences.
	 */
	private int occurrences;
	
	/**
	 * Constructs new entry.
	 * 
	 * @param number Reflects to the clause size.
	 * @param occurrences The number of occurrences in clauses with size {@code number}.
	 */
	public OccurrencePatternEntry(int number, int occurrences)
	{
		this.number = number;
		this.occurrences = occurrences;
	}
	
	/**
	 * Constructs new entry with 0 occurrences.
	 * 
	 * @param number Reflects to the clause size.
	 */
	public OccurrencePatternEntry(int number)
	{
		this(number, 0);
	}

	/**
	 * Returns the number (reflects to the clause size).
	 * 
	 * @return The number (reflects to the clause size).
	 */
	public int getNumber()
	{
		return number;
	}

	/**
	 * Returns the number of occurrences in clauses with size {@code number}.
	 * 
	 * @return The number of occurrences in clauses with size {@code number}.
	 */
	public int getOccurrences()
	{
		return occurrences;
	}
	
	/**
	 * Increases the occurrences value (number of occurrences in clauses with size {@code number})
	 * by 1 and returns the <i>new</i> value.
	 * 
	 * @return The <i>new</i> number off occurrences.
	 */
	public int increaseOccurrence()
	{
		return ++occurrences;
	}
	
}
